﻿using System.IO;
using Domain;

namespace Infrastructure
{
    public class LogText : ILog
    {
        private const string LOG_FILE = "log.txt";

        public LogText()
        {
            var streamReader = new StreamWriter(LOG_FILE);
            streamReader.Close();
        }

        public string Log
        {
            get
            {
                using (var streamReader = new StreamReader(LOG_FILE))
                {
                    return streamReader.ReadToEnd();
                }
            }
            set
            {
                var streamWriter = new StreamWriter(LOG_FILE, true);
                streamWriter.WriteLine(value);
                streamWriter.Close();
            }
        }
    }
}
